<?php

$event = $this->event;
$static_url = "/modules/event/themes";

foreach($this->vote_info as $thread_id=>$thread){
    $voteImgArr = array();
    if(count($thread) >= 1){
        
        foreach($thread as $phase_id=>$phase){
            $now = time();
            if($phase->vote_start_time <= $now && $phase->vote_end_time >= $now){
                $voteImgArr = $this->imgList[$phase->thid][$phase->pid];
                break;
            }
        }
        
    }
    if(empty($voteImgArr)) $voteImgArr = $this->imgList[$phase->thid][$phase->pid];
    $photo_block_id = $thread_id."_".$phase_id;
    $photo_block_title = $phase->thread_name.($phase->phase_name != ""?" - ".$phase->phase_name:"");

    
?>
            <!--Photo:-->
                <a name="mark_photo_<?=$photo_block_id?>"></a>
                <div id="photo" class="images">

                    <div class="title">
                        <img src="<?php print $static_url."/".$event->short_cut; ?>/images/icon12.jpg" width="45" height="45" border="0"  />
                        <a href="<?php
                            if($phase->votephoto_category > 0)
                                echo 'http://photo.tamtay.vn/category/browse/'.$phase->votephoto_category;
                            else 
                                echo "/event/".$event->short_cut."/votedlist/".$thread_id."/".$phase_id;
                                ?>" title="<?=$photo_block_title?>"><?=$photo_block_title?></a>
                    </div> 

                      <div class="photo">
                        <!--Photo Content-->
                        <?php if(is_array($voteImgArr) && count($voteImgArr)>0){?>
                        <ul class="photo-group">
                        <?php 
                            for($i=0; $i<count($voteImgArr) && $i<4; $i++){
                                $imgObj = $voteImgArr[$i];
                            ?>
                            <li class="photo-item">
                                <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                    <img src="<?php echo $static_server.$imgObj->thumbnail;?>" />
                                    <?php echo $imgObj->album_name;?>
                                </a>
                            </li>
                        <?php 
                            }    // End of for
                        ?>
                        </ul>
                        <div class="clear"></div>
                        <?php } // End of if?>
                        <?php if(is_array($voteImgArr) && count($voteImgArr)>4){?>
                        <ul class="photo-group">
                        <?php 
                            for($i=4; $i<count($voteImgArr) && $i<8; $i++){
                                $imgObj = $voteImgArr[$i];
                            ?>
                            <li class="photo-item<?php echo $i==4?" clear-left":""; ?>">
                                <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                    <img src="<?php echo $static_server.$imgObj->thumbnail;?>" />
                                    <?php echo $imgObj->album_name;?>
                                </a>
                            </li>
                        <?php 
                            } // End of for
                        ?>
                        </ul>
                            
                        <div class="clear"></div>
                        <?php } // End of if?>
                        <?php if(is_array($voteImgArr) && count($voteImgArr)>8){?>
                        <ul class="photo-group">
                        <?php 
                            for($i=8; $i<count($voteImgArr) && $i<12; $i++){
                                $imgObj = $voteImgArr[$i];
                            ?>
                            <li class="photo-item<?php echo $i==8?" clear-left":""; ?>">
                                <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                    <img src="<?php echo $static_server.$imgObj->thumbnail;?>" />
                                    <?php echo $imgObj->album_name;?>
                                </a>
                            </li>
                        <?php 
                            } // End of for
                        ?>
                        </ul>
                        
                        <div class="clear"></div>
                        <?php } // End of if?>
                        <?php if(is_array($voteImgArr) && count($voteImgArr)>12){?>
                        <ul class="photo-group">
                        <?php 
                            for($i=12; $i<count($voteImgArr) && $i<16; $i++){
                                $imgObj = $voteImgArr[$i];
                            ?>
                            <li class="photo-item<?php echo $i==12?" clear-left":""; ?>">
                                <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                    <img src="<?php echo $static_server.$imgObj->thumbnail;?>" />
                                    <?php echo $imgObj->album_name;?>
                                </a>
                            </li>
                        <?php 
                            } // End of for
                        ?>
                        </ul>
                        
                        <div class="clear"></div>
                        <?php } // End of if?>
                        <?php if(is_array($voteImgArr) && count($voteImgArr)>16){?>
                        <ul class="photo-group">
                        <?php 
                            for($i=16; $i<count($voteImgArr) && $i<20; $i++){
                                $imgObj = $voteImgArr[$i];
                            ?>
                            <li class="photo-item<?php echo $i==16?" clear-left":""; ?>">
                                <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                    <img src="<?php echo $static_server.$imgObj->thumbnail;?>" />
                                    <?php echo $imgObj->album_name;?>
                                </a>
                            </li>
                        <?php 
                            } // End of for
                        ?>
                        </ul>
                        <div class="clear"></div>
                        <?php } // End of if?>
                        <?php if(is_array($voteImgArr) && count($voteImgArr)>20){?>
                        <ul class="photo-group">
                        <?php 
                            for($i=20; $i<count($voteImgArr) && $i<24; $i++){
                                $imgObj = $voteImgArr[$i];
                            ?>
                            <li class="photo-item<?php echo $i==20?" clear-left":""; ?>">
                                <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                    <img src="<?php echo $static_server.$imgObj->thumbnail;?>" />
                                    <?php echo $imgObj->album_name;?>
                                </a>
                            </li>
                        <?php 
                            } // End of for
                        ?>
                        </ul>
                        <div class="clear"></div>
                        <?php } // End of if?>
                        <?php if(is_array($voteImgArr) && count($voteImgArr)>24){?>
                        <ul class="photo-group">
                        <?php 
                            for($i=24; $i<count($voteImgArr) && $i<28; $i++){
                                $imgObj = $voteImgArr[$i];
                            ?>
                            <li class="photo-item<?php echo $i==24?" clear-left":""; ?>">
                                <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                    <img src="<?php echo $static_server.$imgObj->thumbnail;?>" />
                                    <?php echo $imgObj->album_name;?>
                                </a>
                            </li>
                        <?php 
                            } // End of for
                        ?>
                        </ul>
                        <div class="clear"></div>
                        <?php } // End of if?>
                        <?php if(is_array($voteImgArr) && count($voteImgArr)>28){?>
                        <ul class="photo-group">
                        <?php 
                            for($i=28; $i<count($voteImgArr) && $i<32; $i++){
                                $imgObj = $voteImgArr[$i];
                            ?>
                            <li class="photo-item<?php echo $i==28?" clear-left":""; ?>">
                                <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                    <img src="<?php echo $static_server.$imgObj->thumbnail;?>" />
                                    <?php echo $imgObj->album_name;?>
                                </a>
                            </li>
                        <?php 
                            } // End of for
                        ?>
                        </ul>
                        <div class="clear"></div>
                        <?php } // End of if?>
                        <?php if(is_array($voteImgArr) && count($voteImgArr)>32){?>
                        <ul class="photo-group">
                        <?php 
                            for($i=32; $i<count($voteImgArr) && $i<36; $i++){
                                $imgObj = $voteImgArr[$i];
                            ?>
                            <li class="photo-item<?php echo $i==32?" clear-left":""; ?>">
                                <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                    <img src="<?php echo $static_server.$imgObj->thumbnail;?>" />
                                    <?php echo $imgObj->album_name;?>
                                </a>
                            </li>
                        <?php 
                            } // End of for
                        ?>
                        </ul>
                        <div class="clear"></div>
                        <?php } // End of if?>
                        <?php if(is_array($voteImgArr) && count($voteImgArr)>36){?>
                        <ul class="photo-group">
                        <?php 
                            for($i=36; $i<count($voteImgArr) && $i<40; $i++){
                                $imgObj = $voteImgArr[$i];
                            ?>
                            <li class="photo-item<?php echo $i==36?" clear-left":""; ?>">
                                <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                    <img src="<?php echo $static_server.$imgObj->thumbnail;?>" />
                                    <?php echo $imgObj->album_name;?>
                                </a>
                            </li>
                        <?php 
                            } // End of for
                        ?>
                        </ul>
                        <div class="clear"></div>
                        <?php } // End of if?>
                        <?php if(is_array($voteImgArr) && count($voteImgArr)>40){?>
                        <ul class="photo-group">
                        <?php 
                            for($i=40; $i<count($voteImgArr) && $i<44; $i++){
                                $imgObj = $voteImgArr[$i];
                            ?>
                            <li class="photo-item<?php echo $i==40?" clear-left":""; ?>">
                                <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                    <img src="<?php echo $static_server.$imgObj->thumbnail;?>" />
                                    <?php echo $imgObj->album_name;?>
                                </a>
                            </li>
                        <?php 
                            } // End of for
                        ?>
                        </ul>
                        <div class="clear"></div>
                        <?php } // End of if?>
                        <?php if(is_array($voteImgArr) && count($voteImgArr)>44){?>
                        <ul class="photo-group">
                        <?php 
                            for($i=44; $i<count($voteImgArr) && $i<48; $i++){
                                $imgObj = $voteImgArr[$i];
                            ?>
                            <li class="photo-item<?php echo $i==44?" clear-left":""; ?>">
                                <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                    <img src="<?php echo $static_server.$imgObj->thumbnail;?>" />
                                    <?php echo $imgObj->album_name;?>
                                </a>
                            </li>
                        <?php 
                            } // End of for
                        ?>
                        </ul>
                        <div class="clear"></div>
                        <?php } // End of if?>
                        <?php if(is_array($voteImgArr) && count($voteImgArr)>48){?>
                        <ul class="photo-group">
                        <?php 
                            for($i=48; $i<count($voteImgArr) && $i<52; $i++){
                                $imgObj = $voteImgArr[$i];
                            ?>
                            <li class="photo-item<?php echo $i==48?" clear-left":""; ?>">
                                <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                    <img src="<?php echo $static_server.$imgObj->thumbnail;?>" />
                                    <?php echo $imgObj->album_name;?>
                                </a>
                            </li>
                        <?php 
                            } // End of for
                        ?>
                        </ul>
                        <div class="clear"></div>
                        <?php } // End of if?>
                        <?php if(is_array($voteImgArr) && count($voteImgArr)>52){?>
                        <ul class="photo-group">
                        <?php 
                            for($i=52; $i<count($voteImgArr) && $i<56; $i++){
                                $imgObj = $voteImgArr[$i];
                            ?>
                            <li class="photo-item<?php echo $i==52?" clear-left":""; ?>">
                                <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                    <img src="<?php echo $static_server.$imgObj->thumbnail;?>" />
                                    <?php echo $imgObj->album_name;?>
                                </a>
                            </li>
                        <?php 
                            } // End of for
                        ?>
                        </ul>
                        <div class="clear"></div>
                        <?php } // End of if?>
                        <?php if(is_array($voteImgArr) && count($voteImgArr)>56){?>
                        <ul class="photo-group">
                        <?php 
                            for($i=56; $i<count($voteImgArr) && $i<60; $i++){
                                $imgObj = $voteImgArr[$i];
                            ?>
                            <li class="photo-item<?php echo $i==56?" clear-left":""; ?>">
                                <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                    <img src="<?php echo $static_server.$imgObj->thumbnail;?>" />
                                    <?php echo $imgObj->album_name;?>
                                </a>
                            </li>
                        <?php 
                            } // End of for
                        ?>
                        </ul>
                        <div class="clear"></div>
                        <?php } // End of if?>
                        <?php if(is_array($voteImgArr) && count($voteImgArr)>60){?>
                        <ul class="photo-group">
                        <?php 
                            for($i=60; $i<count($voteImgArr) && $i<64; $i++){
                                $imgObj = $voteImgArr[$i];
                            ?>
                            <li class="photo-item<?php echo $i==60?" clear-left":""; ?>">
                                <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                    <img src="<?php echo $static_server.$imgObj->thumbnail;?>" />
                                    <?php echo $imgObj->album_name;?>
                                </a>
                            </li>
                        <?php 
                            } // End of for
                        ?>
                        </ul>
                        <?php } // End of if?>
                        <div class="clear"></div>
                    </div> 
                    <div class="chitiet"><a href="http://www.tamtay.vn/event/<?=$event->short_cut;?>/votedalbumlist/<?=$thread_id;?>/<?=$phase_id;?>">Xem tiếp &raquo;</a></div>
                     <div class="clear"></div>
                </div> 
                <!--End photo-->
                
<?php
} ?>